package com.sq.partner.manager.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sq.partner.manager.dao.IGatewaySubChannelDao;
import com.sq.partner.manager.mybatis.model.GatewaySubChannel;
import com.sq.partner.manager.mybatis.model.GatewayUser;
import com.sq.partner.manager.service.IGatewaySubChannelService;
import com.sq.partner.manager.util.Page;
@Service
public class GatewaySubChannelServiceImpl implements IGatewaySubChannelService{

	@Resource
	private IGatewaySubChannelDao subChannelDao;

	@Override
	public Page<GatewaySubChannel> querySubChannelByFuzzyCriteria(Integer pageIndex,
			GatewaySubChannel subChannel, GatewayUser user) throws Exception {
		Page<GatewaySubChannel> subChannelPage = subChannelDao.querySubChannelByFuzzyCriteria(pageIndex, subChannel, user);
		return subChannelPage;
	}

	@Override
	public Page<GatewaySubChannel> queryChannelTreeByOneUser(GatewayUser user,Page<GatewaySubChannel> page)
			throws Exception {
		return subChannelDao.queryChannelTreeByOneUser(user,page);
	}

	@Override
	public boolean saveOrUpdateSubChannel(GatewaySubChannel subChannel,
			String flag) throws Exception {
		if(flag.equals("save")){
			return subChannelDao.save(subChannel);
		}
		if(flag.equals("update")){
			return subChannelDao.update("updateGatewaySubChannel", subChannel);
		}
		return false;
	}

	@Override
	public List<GatewaySubChannel> querySubChannelListBySubChannel(
			GatewaySubChannel subChannel) throws Exception {
		List<GatewaySubChannel> subChannelList = subChannelDao.queryBySubChannel(subChannel);
		return subChannelList;
	}
	
	@Override
	public boolean delSubChannel(String subChannelCode) throws Exception {
		return subChannelDao.delete(subChannelCode);
	}

	@Override
	public GatewaySubChannel querySubChannelInfoById(
			String subChannelCode) throws Exception {
		return subChannelDao.querySubChannelInfoById(subChannelCode);
	}

	@Override
	public boolean delSubChannel1(Map<String, String> map) throws Exception {
		// TODO Auto-generated method stub
		return  subChannelDao.delete1(map);
	}

	@Override
	public GatewaySubChannel querySubChannelInfoByCondition(
			Map<String, String> map) throws Exception {
		// TODO Auto-generated method stub
		return subChannelDao.querySubChannelInfoByCondition(map);
	}
	@Override
	public  List<Map<String, Object>> impNlifeSub(Map<String, Object> map)
			throws Exception {
		// TODO Auto-generated method stub
		return subChannelDao.impNlifeSub(map);
	}

	@Override
	public List<GatewaySubChannel> searchGatewaySubChannelsListByplanCode(
			Map<String, Object> maps) throws Exception {
		// TODO Auto-generated method stub
		return subChannelDao.searchGatewaySubChannelsListByplanCode(maps);
	}

}
